﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace PyramidShadow
{
    /*
     * An area which marks the Exit area of the current actualLevel.
     * Not neccesarry visible, just triggers the end and loads the new actualLevel
     * Note: Even if the exit is invisible, we need to load a proper 
     *       transparent texture to get boundingBox of it.
     */

    class Exit : LevelObject
    {
        private SpawnPoint spawnPoint;
        public SpawnPoint SpawnPoint
        {
            get { return spawnPoint; }
        }
        
        public Exit(Texture2D texture, Vector2 position, Level level) : base(texture,position,level)
        {
            spawnPoint = new SpawnPoint(position);
        }

        public override void Update(GameTime gameTime, KeyboardState currentKeyboardState)
        {
            if(level.kollision.intersection(level.body.BoundingBox,boundingBox))
                level.showVictoryScreen();
        }
    }
}
